use std::fs;


#[tauri::command]
pub fn read_file(filepath: &str) -> String {
    let text = fs::read_to_string(filepath).unwrap();
    return text;
}

#[tauri::command]
pub fn write_file(filepath: &str, content: &str) {
    fs::write(filepath, content).unwrap()
}

#[tauri::command]
pub fn delete_file(filepath: &str) {
    fs::remove_file(filepath).unwrap()
}

#[tauri::command]
pub fn get_loacl_ip() -> String {
    local_ipaddress::get().unwrap()
}

#[tauri::command]
pub fn fullscreen(window: tauri::Window) {
    if tauri::window::Window::is_fullscreen(&window).unwrap() {
        let _ = tauri::window::Window::set_fullscreen(&window, false);
    }else {
        let _ = tauri::window::Window::set_fullscreen(&window, true);
    }
} 
